<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/metro/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/icon.css"/>">
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery-1.6.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.panel.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.datagrid.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.messager.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/ext-for-framework.js.jsp"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/locale/easyui-lang-zh_CN.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/js/common.js"/>"></script>



<script type="text/javascript">


    function dopay() {
        alert("test");
        $.ajax({type : 'POST',
         url : '<%=contextPath%>/pay/gopay.html',
        dataType : 'json',
data:{ openId : '<%=openId%>',time:'<%=orderTime%>'},
cache : false,
error : function() {
alert('出错了！');
return false;
},


success : function(data) {
//alert("data"+data[0].agent);  
//var obj = eval('(' + data[0] + ')');
//alert("obj"+obj);  
            if(parseInt(data[0].agent)<5){  
                alert("您的微信版本低于5.0无法使用微信支付");  
                return;  
            }  
            WeixinJSBridge.invoke('getBrandWCPayRequest',{  
                "appId" : data[0].appId,                  //公众号名称，由商户传入  
                "timeStamp": data[0].timeStamp,          //时间戳，自 1970 年以来的秒数  
                "nonceStr" : data[0].nonceStr,         //随机串  
                "package" : data[0].packageValue,      //<span style="font-family:微软雅黑;">商品包信息</span>  
                "signType" : data[0].signType,        //微信签名方式:  
                "paySign" : data[0].paySign           //微信签名  
                },function(res){      
                    //alert(res.err_msg);  
                if(res.err_msg == 'get_brand_wcpay_request:ok' ) {  
                      alert("支付成功,按确定跳转页面");  
                    window.location.href=data[0].sendUrl;  
                }else{  
                    alert("支付失败/取消,从新生成支付链接.");  
                    window.location.href='<%=contextPath%>/mobile/submitOrder.html?openId=<%=openId%>&pay=gopay&type=2&ordertime=<%=orderTime%>'
	';
												//<span style="font-family:微软雅黑;">当失败后，继续跳转该支付页面让用户可以继续付款，
												//贴别注意不能直接调转jsp，
												//</span><span style="font-size:10.5pt">不然会报</span><span style="font-size:12.0pt"> 
												//system:access_denied。</span>  
											}
										});
					}
				});
	}
</script>
</head>

<body>
	<div id="drag">
		<h2>蔬菜</h2>
		<table>
			<tr>
				<td>区域位置设定</td>
			</tr>
		</table>
	</div>
</body>
</html>